home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ETO Development Tools 4
/
ETO Development Tools 4.iso
/
Tools - Objects
/
Virtual User 1.0
/
Example Scripts
/
LocalizeExample.vu
< prev
next >
Wrap
Text File
|
1991-01-25
|
2KB
|
67 lines
#
# File: LocalizeExample.vu
#
# Contains: An example on how to write your scripts so that they are adaptable
# to various international systems or application versions.
# This script determines what system is running and determines
# the appropriate string list resource for that system. Then if the
# string list is found, it fetches the appropriate translation of the
# "Quit" string for the system. It then selects the "quit" menuitem
# (or international equivalent) from the "file" menu using the fetched
# string.
#
# To run this script successfully, you need to be running either a Kanji
# system or a U.S. 6.0.x or 7.0.x system. These are the only systems for
# which string resources have been created. You should also be running
# an application with a "Quit" menuitem in its "file" menu.
#
# Conventions: Global variables begin with a capital letter
#
# Written by: P Nagarajan and Jim Schneider
#
# Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
#
# Change History:
#
# 1/10/91 JAS use string list resources
# 8/3/89 naga creation
#
# **************************************************************************************
# Get the string list resource ID corresponding to the system_version string
task get_str_list_ID(system_version) begin
global KANJI_STRS;
global US_STRS;
global NOT_FOUND;
If (system_version[1]+system_version[2] = "J1") do # it's Kanji system
the_str_List_ID := KANJI_STRS;
else If ((system_version[1]+system_version[2] = "6.") or # it's US 6.0.x system
(system_version[1]+system_version[2] = "7.")) do # it's US 7.0.x system
the_str_list_ID := US_STRS;
else the_str_list_ID := NOT_FOUND;
return(the_str_list_ID);
end;
##### EXECUTION STARTS HERE ######
# set index into string list resource for "Quit" string
Quit_str_index := 1;
# set string list resource id constants
US_STRS := 128;
KANJI_STRS := 129;
NOT_FOUND := -1;
match[system v:?System_version]; # get system version
Str_list_id := get_str_list_ID(System_version); # get the str list ID for the system version
if (Str_list_id <> NOT_FOUND) do begin # we have the string list
The_quit_str := getIndString(Str_list_id,Quit_str_index); # get str from str list resource
select[menuItem t:The_quit_str m:[menu o:2]]!; # select the menuitem
end;
else begin # string list not found
println 'String list for this system not found';
end;